package ciyuan.Entity;

import ciyuan.Entity.ExplosionTrap.ExplosionTrapEntity;
import ciyuan.Entity.ExplosionTrap.ExplosionTrapRender;
import ciyuan.Entity.FlameBall.FlameBallEntity;
import ciyuan.Entity.FlameBall.FlameBallRender;
import ciyuan.Entity.IceBall.IceBallEntity;
import ciyuan.Entity.IceBall.IceBallRender;
import ciyuan.Entity.MagicBall.MagicBallEntity;
import ciyuan.Entity.MagicBall.MagicBallRender;
import ciyuan.Entity.MagicTexture.MagicTextureEntity;
import ciyuan.Entity.MagicTexture.MagicTextureRender;
import ciyuan.Entity.WindBall.WindBallEntity;
import ciyuan.Entity.WindBall.WindBallRender;
import ciyuan.MainClass;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

/**
 * @author 150149
 */
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class EntityRegisterManager {

    public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, MainClass.MODID);
    public static final RegistryObject<EntityType<MagicBallEntity>> magicball = ENTITY_TYPES.register("magicball", () -> EntityType.Builder.<MagicBallEntity>of(MagicBallEntity::new, EntityClassification.MISC).sized(0.5F, 0.5F).build("magicball"));
    public static final RegistryObject<EntityType<FlameBallEntity>> flameball = ENTITY_TYPES.register("flameball", () -> EntityType.Builder.<FlameBallEntity>of(FlameBallEntity::new, EntityClassification.MISC).sized(0.5F, 0.5F).build("flameball"));
    public static final RegistryObject<EntityType<WindBallEntity>> windball = ENTITY_TYPES.register("windball", () -> EntityType.Builder.<WindBallEntity>of(WindBallEntity::new, EntityClassification.MISC).sized(0.5F, 0.5F).build("windball"));
    public static final RegistryObject<EntityType<IceBallEntity>> iceball = ENTITY_TYPES.register("iceball", () -> EntityType.Builder.<IceBallEntity>of(IceBallEntity::new, EntityClassification.MISC).sized(0.5F, 0.5F).build("iceball"));
    public static final RegistryObject<EntityType<MagicTextureEntity>> magictexture = ENTITY_TYPES.register("magictexture", () -> EntityType.Builder.of(MagicTextureEntity::new, EntityClassification.MISC).sized(0.1F, 0.1F).build("magictexture"));
    public static final RegistryObject<EntityType<ExplosionTrapEntity>> explosiontrap = ENTITY_TYPES.register("explosiontrap", () -> EntityType.Builder.of(ExplosionTrapEntity::new, EntityClassification.MISC).sized(1F, 0.5F).build("explosiontrap"));


    @SubscribeEvent
    public static void onClientSetUpEvent(FMLClientSetupEvent event) {
        RenderingRegistry.registerEntityRenderingHandler(EntityRegisterManager.magicball.get(), MagicBallRender::new);
        RenderingRegistry.registerEntityRenderingHandler(EntityRegisterManager.flameball.get(), FlameBallRender::new);
        RenderingRegistry.registerEntityRenderingHandler(EntityRegisterManager.windball.get(), WindBallRender::new);
        RenderingRegistry.registerEntityRenderingHandler(EntityRegisterManager.iceball.get(), IceBallRender::new);
        RenderingRegistry.registerEntityRenderingHandler(EntityRegisterManager.magictexture.get(), MagicTextureRender::new);
        RenderingRegistry.registerEntityRenderingHandler(EntityRegisterManager.explosiontrap.get(), ExplosionTrapRender::new);
    }


}
